package org.cuatrovientos.erp.business;

import java.util.List;

import org.apache.log4j.Logger;
import org.cuatrovientos.erp.dao.EmployeeDAOInterface;
import org.cuatrovientos.erp.model.Employee;
import org.springframework.beans.factory.annotation.Autowired;
/**
 * 
 * 
 * @author CaselHunter
 *
 */

public class EmployeeBO implements EmployeeBOInterface {
	
	// Get log4j logger
	private static final Logger logger = Logger.getLogger(EmployeeBO.class);
	 
	@Autowired
    private EmployeeDAOInterface employeeDAO;

	@Override
	public Employee selectById(int id) {
		logger.info("selectById: " + id);
		return employeeDAO.selectById(id);
	}

	@Override
	public List<Employee> selectAll() {
		logger.info("selectAll: ");
		return employeeDAO.selectAll();
	}

	@Override
	public List<Employee> search(String name) {
		logger.info("search : " + name);
		return employeeDAO.search(name);
	}

	@Override
	public void deleteById(int id) {
		logger.info("delete: " + id);
		 employeeDAO.deleteById(id);
	}

	@Override
	public void insert(Employee employee) {
		logger.info("insert: " + employee);
		employeeDAO.insert(employee);
	}

	@Override
	public void update(Employee employee) {
		logger.info("update: " + employee);
		employeeDAO.update(employee);
	}
}
